<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  mod_menu
 *
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

$document = JFactory::getDocument();
$direction = $document->direction == 'rtl' ? 'pull-right' : '';
$db = JFactory::getDbo();
	// Create a new query object.
	$query  = $db->getQuery(true);
	$user   = & JFactory::getUser();
	$uid  	= $user->get('id');
	// Select all records from the user profile table where key begins with "custom.".
	// Order it by the ordering field.
	$query
    ->select(array('a.title', 'b.user_id','b.group_id'))
    ->from('#__usergroups AS a')
    ->join('INNER', '#__user_usergroup_map AS b ON (a.id = b.group_id)')
    ->where('b.user_id='.$uid);
	// Reset the query using our newly populated query object.
	$db->setQuery($query);
	$results = $db->loadObjectList();
	foreach($results as $row){
		$title = $row->title;
	}
	if($title!='Clients'){
		require JModuleHelper::getLayoutPath('mod_menu', $enabled ? 'default_enabled' : 'default_disabled');
	}else{
		require JModuleHelper::getLayoutPath('mod_menu', 'default_clients');
	}
	$menu->renderMenu('menu', $enabled ? 'nav ' . $direction : 'nav disabled ' . $direction);
